home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / flute.zip / SAMP_ACT.C / WINDACTS.H < prev   
Text File  |  1995-04-05  |  6KB  |  160 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. // WindActs.h
  3. // Definitions of data objects
  4.  
  5. /************************* object var structures ****************************/
  6. // Data is stored in the following structures
  7. // Notice that a short begins every object type - this short (called vtype)
  8. // identifies what type of object follows
  9.  
  10. #define    NULLTYPE 0
  11. #define    INTTYPE    1
  12. #define    FLOATTYPE    2
  13. #define    DOUBLETYPE    3
  14. #define    STRINGTYPE    4
  15. #define    BOOLTYPE    5
  16. #define    ERRORTYPE    6
  17. #define    DATETYPE    7
  18. #define    HMSTYPE        8
  19. #define    COMPLEXTYPE    9
  20. #define    EQUATIONTYPE    10
  21. #define    ARRAYTYPE    11
  22.  
  23. /* Storage for an integer 32 bit */
  24. // a NULL object has vtype=0, and value=0
  25. typedef struct t_int {
  26.         short   vtype;    // vtype=1 for an integer, vtype=0 for a NULL
  27.         long    value;
  28.         } IntObj;
  29.  
  30. /* Storage for a floating point number */
  31. typedef struct t_float {
  32.         short   vtype;    // vtype = 2 for a float
  33.         float   value;
  34.         } FloatObj;
  35.  
  36. /* Storage for a double floating point number */
  37. typedef struct t_double {
  38.         short   vtype;    // vtype = 3 for a double
  39.         double  value;
  40.         } DoubleObj;
  41.  
  42. /* Storage for a string object */
  43. typedef struct t_string {
  44.         short   vtype;    // vtype = 4 for a string
  45.         short   length;
  46.         char    value[1];
  47.         } StringObj;
  48.  
  49. /* storage for boolean object (same as IntObj)*/
  50. typedef struct  t_boolean {
  51.         short   vtype;    // vtype = 5 for boolean
  52.         long   value;
  53.         } BoolObj;
  54.  
  55. /* Storage for a error object (Errors are string Objects)*/
  56. typedef struct t_error {
  57.         short   vtype;    // vtype = 6 for an error
  58.         short   length;
  59.         char    value[1];
  60.         } ErrorObj;
  61.  
  62. /* storage for a date object */
  63. typedef struct  t_date {
  64.         short   vtype;    // vtype = 7 for a date
  65.         short   day;    //1-31
  66.         short   month;    // 1-12
  67.         short   year;    // e.g. 1995
  68.         } DateObj;
  69.  
  70. /* storage for a Time Object type */
  71. typedef struct t_hms {
  72.         short   vtype;    // vtype = 8 for a time
  73.         short   hours;    //0-23
  74.         short   minutes;    //0-59
  75.         short   seconds;    //0-59
  76.         } HmsObj;
  77.  
  78. /* storage for a complex number type */
  79. typedef struct t_complex {
  80.         short   vtype;    // vtype = 9 for complex number
  81.         double   realpart;
  82.         double   imagepart;
  83.         } ComplexObj;
  84.  
  85. /* storage for an equation (same as stringobj)*/
  86. typedef struct t_equation {
  87.         short   vtype;    // vtype = 10 for equation
  88.         short   length;
  89.         char    value[1];   
  90.         } EquationObj;
  91.  
  92. /* storage for an array (data objects follow at 'Value' position)*/
  93. typedef struct t_array {
  94.         short   vtype;    // vtype = 11 for array
  95.         short   elements;
  96.         char    value[1];
  97.         } ArrayObj;
  98.  
  99. /* structure for a complete variable object */
  100. // Given a ptr to a DataObj, by examining the tint.vtype field you can
  101. // find what type of data object the ptr points to.
  102. typedef union  varObj {
  103.         struct  t_int  tint;        // integer and null
  104.         struct  t_float tfloat;        // floating point number
  105.         struct  t_double tdouble;    // double precision number
  106.         struct  t_string tstring;    // string object
  107.         struct  t_boolean tboolean;    // boolean object
  108.         struct  t_error terror;        // error object
  109.         struct  t_date tdate;        // date object
  110.         struct  t_hms thms;            // hours minutes seconds object (time)
  111.         struct  t_complex tcomplex;    // complex number object
  112.         struct  t_equation tequation;    // equation object
  113.         struct  t_array tarray;        // array of DataObjs 
  114.         } DataObj;
  115.  
  116.  
  117. //////////////////////////////////////////////////////////////////////////////////////////////////
  118. // macros used to define the locking of objects
  119. // These macros lock objects and cast the ptr to the correct types
  120.  
  121. // global lock a data obj and cast to type DataObj *
  122. #define DataGlobalLock(a)    (DataObj FAR *)GlobalLock(a)
  123.  
  124. // step to the next data object in an array
  125. #define NextDataObj(a)        (DataObj FAR *)(((char FAR *)(a))+GetVarSize(a))
  126.  
  127. // return a ptr to the contents of an array as a DataObj *
  128. #define PtrContent(optr)    ((DataObj FAR *)(optr->tarray.value))
  129.  
  130. // move ptr 'a' by 'b' bytes
  131. #define    StepBytes(a,b)    (DataObj *)(((char *)(a))+b)
  132.  
  133.  
  134. /////////////////////////////////////////////////////////////////////////////////////////////////
  135. // Functions prototypes for functions in WindActs.c
  136.  
  137. long GetVarSize(DataObj  FAR *op1);
  138. UINT    RegisterResourceString(HINSTANCE hInst, UINT msgid);
  139. HGLOBAL ProduceActList(HINSTANCE hInst, UINT baseID);
  140. void    RegisterActList(HINSTANCE hInst, UINT baseID,UINT FAR * messID);
  141. void FindActName(HINSTANCE hInst, UINT ActId, UINT baseID, LPSTR pBuff, int len);
  142. void SetWindowFluteName(HWND hWnd, LPCSTR lpBuff);
  143. void SetDlgItemFluteName(HWND hDlg, UINT id, LPCSTR lpBuff);
  144. void ClearWindowFluteName(HWND hWnd);
  145. void ClearDlgItemFluteNames(HWND hDlg);
  146. HGLOBAL    MakeString(LPCSTR lpBuff);
  147. HGLOBAL    GeneralError(HINSTANCE hInst, UINT id);
  148. HGLOBAL MakeInt(long lval);
  149. HGLOBAL MakeDouble(double dval);
  150. HGLOBAL NullObj();
  151. long GetALong(DataObj FAR *optr, BOOL FAR *pTrans);
  152. double GetADouble(DataObj FAR *optr, BOOL FAR *pTrans);
  153. void GetAString(DataObj FAR *optr, BOOL FAR *pTrans, char FAR *pBuff, UINT len);
  154. HGLOBAL MakeArrayN(HGLOBAL FAR *pHands, UINT N);
  155. HGLOBAL    MakeArray2(HGLOBAL    Obj1, HGLOBAL Obj2);
  156. HGLOBAL    MakeArray3(HGLOBAL    Obj1, HGLOBAL Obj2, HGLOBAL Obj3);
  157. HGLOBAL    MakeArray4(HGLOBAL    Obj1, HGLOBAL Obj2, HGLOBAL Obj3, HGLOBAL Obj4);
  158.  
  159.  
  160.